<template>
    <div>
    12312312
        从store中取出来的num值为：{{num}},
        加的值为：<input v-model="addNum" type="number">
        <button @click="getCount">点击我获取module1中的count值</button>
        <button @click="getName">点击我获取module1中的name值</button>

        <button @click="addCount">点击我将store中取出来的num值加{{addNum}}</button>

    </div>
</template>

<script>

export default {
    name: 'Test2',
    data(){
        return{
            //num: 0
            addNum: 1
        }
    },
    computed:{
        num(){
            return this.$store.state.module1.count;
        }
    },
    created(){
        console.log(this.$store)
    },
    methods: {
        getCount(){
            alert(this.$store.getters.getCount)
        },
        getName(){
            alert(this.$store.getters.getName)
        },
        addCount(){
            this.$store.dispatch('add',this.addNum)
        }
        
    }
}
</script>

